<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<title></title>
	</head>

	<body>
		<input type="button" name="" id="" value="计算器" onclick="myf()" />
		<script type="text/javascript">
			var x = parseFloat(prompt("请输入第一个数", "0"));
			var y = parseFloat(prompt("请输入第二个数", "0"));
			var i = prompt("请输入运算符", "+");

			function myf(x, y, i) {
				if(i == "+") {
					console.log(x + y)
				} else if(i == "-") {
					console.log(x - y)
				} else if(i == "*") {
					console.log(x * y)
				} else if(i == "/") {
					console.log(x / y)
				}
			}
		</script>
	</body>

</html>